﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.Models.Common;
using TianShiProject.Models.HumanAffairs.Leaves;
using Volo.Abp.Application.Services;

namespace TianShiProject.HumanAffairs.Leaves
{
    public class LeaveService : ApplicationService
    {
        private readonly ILeaveRepository _leaveRepository;
        public LeaveService(ILeaveRepository leaveRepository)
        {
            _leaveRepository = leaveRepository;
        }

        #region 离职办理——查询分页显示
        /// <summary>
        /// 离职办理——查询分页显示
        /// </summary>
        /// <param name="LeaveName"></param>
        /// <param name="DeptId"></param>
        /// <param name="PositionId"></param>
        /// <param name="EntryTime"></param>
        /// <param name="LastTime"></param>
        /// <param name="State"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public async Task<PageResponse<LeaveDto>> GetLeavePageShow(string LeaveName, int DeptId, int PositionId, DateTime? EntryTime, DateTime? LastTime, int State, int pageindex = 1, int pagesize = 3)
        {
            return await _leaveRepository.GetLeavePageShow(LeaveName, DeptId, PositionId, EntryTime, LastTime, State, pageindex, pagesize);
        }
        #endregion

        #region 离职办理——逻辑删除
        /// <summary>
        /// 离职办理——逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<int> DeleteLeave(int id)
        {

            return await _leaveRepository.DeleteLeave(id);
        }
        #endregion

        #region 离职办理——批量删除
        /// <summary>
        /// 离职办理——批量删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public async Task<int> DeleteBatchLeave(string ids)
        {
            return await _leaveRepository.DeleteBatchLeave(ids);
        }
        #endregion

        #region 离职办理——编辑
        /// <summary>
        /// 离职办理——编辑
        /// </summary>
        /// <param name="leaveDto"></param>
        /// <returns></returns>
        public async Task<int> PutUpdateLeave(LeaveDto leaveDto)
        {
            return await _leaveRepository.PutUpdateLeave(leaveDto);
        }
        #endregion

        #region 离职办理——添加
        /// <summary>
        /// 离职办理——添加
        /// </summary>
        /// <param name="leaveDto"></param>
        /// <returns></returns>
        public async Task<int> PostAddLeave(LeaveDto leaveDto)
        {
            return await _leaveRepository.PostAddLeave(leaveDto);
        }
        #endregion
    }
}
